<template>
  <div>
    <input type="text" style="display: none" />
    <el-form class="query-form" :inline="true" :model="params">
      <el-form-item label="名称查询">
        <el-input
          v-model="params.load_name"
          @keyup.native.enter="getData"
          placeholder="产品名称查询"
        ></el-input>
      </el-form-item>
    </el-form>

    <loading-wrap>
      <el-table border :data="tableData">
        <el-table-column prop="load_type" align="center" label="产品类型"></el-table-column>
        <el-table-column prop="load_name" align="center" label="产品名称"></el-table-column>
        <el-table-column prop="project_num" align="center" label="项目数"></el-table-column>
        <el-table-column
          prop="reply_funds_total"
          align="center"
          :label="'金额(' + fundsAll + ')(万元)'"
        ></el-table-column>
        <el-table-column prop="guar_fee" align="center" label="产品费率"></el-table-column>
      </el-table>
    </loading-wrap>
  </div>
</template>
<script>
export default {
  components: {},
  props: {},
  data() {
    return {
      params: {
        load_name: '',
        'service_id.eq': '',
      },
      tableData: [],
      fundsAll: 0,
    }
  },
  computed: {},
  watch: {},
  created() {
    this.getData()
  },
  mounted() {},
  methods: {
    async getData() {
      this.fundsAll = 0
      const [res] = await this.$utils.promise(
        this.$api.getData('credit', 'credit_load_product_total_view', this.params)
      )
      if (res) {
        this.tableData = res.data || []
        let solidTotal = 0
        for (const d of res.data) {
          const t = Number.parseFloat(d.reply_funds_total)
          const o = isNaN(t) ? 0 : t
          solidTotal += o
        }
        this.fundsAll = Math.round(solidTotal * 100) / 100
      }
    },
  },
}
</script>
<style lang="scss"></style>
